package org.dandelion.papercheck.util;

import java.util.regex.Pattern;

public class ValidateUtil {
    public static boolean validateEmail(String email) {
        if (email == null || email.isEmpty()) {
            return false;
        }

        String reg = "^(\\w+([-.][A-Za-z0-9]+)*){3,18}@\\w+([-.][A-Za-z0-9]+)*\\.\\w+([-.][A-Za-z0-9]+)*$";

        return Pattern.matches(reg, email);
    }

    public static boolean validatePhone(String phone) {
        if (phone == null || phone.isEmpty()) {
            return false;
        }

        String reg = "^((13[0-9])|(14[5|7])|(15([0-35-9]))|(17[013678])|(18[01,5-9]))\\d{8}$";

        return Pattern.matches(reg, phone);
    }
}
